package com.my.url;

import java.net.URL;

/**
 * @author: marshal
 * @date: 2021-12-30 1:44 PM
 */
public class UrlTest {
    public static void main(String[] args) throws Exception{
        var path = "https://exmaple.com:80/docs/book/tutorail/index.html?name=networking#DOWNLOADING";
        var url = new URL(path);
        System.out.println("protocol = " + url.getProtocol());
        System.out.println("authority = " + url.getAuthority());
        System.out.println("host = " + url.getHost());
        System.out.println("port = " + url.getPort());
        System.out.println("path = " + url.getPath());
        System.out.println("query = " + url.getQuery());
        System.out.println("filename = " + url.getFile());
        System.out.println("ref = " + url.getRef());
    }
}
